<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/admin/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    
    <form id="DataForm" action="" method="POST" class="layui-form layui-form-pane">
        <div class="layui-tab layui-tab-brief" lay-filter="itemTab">
            <ul class="layui-tab-title">
                <li lay-id="itemTab_2" class="layui-this">基本信息</li>
                <li lay-id="itemTab_3">证照资料</li>
                <li lay-id="itemTab_4">银行卡</li>
                <li lay-id="itemTab_5">商户设置</li>
                <li lay-id="itemTab_6">补助设置</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label">店铺名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="info[title]" placeholder="请输入店铺名称" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">店铺LOGO</label>
                        <div class="layui-input-block">
                            <input type="text" name="info[logo]" id="logo" autocomplete="off"
                                class="layui-input layui-col-xs6" readonly>
                            <div class="layuimini-upload-btn">
                                <button type="button" class="layui-btn" id="upload_logo"><i
                                        class="fa fa-upload"></i>
                                    上传图片</button>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户分类</label>
                        <div class="layui-input-block">
                            <select name="info[category_id]">
                                <option value="0">请选择商户分类</option>
                                {foreach $category as $val}
                                <option value="{$val.id}">{$val.name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">店铺电话</label>
                        <div class="layui-input-block">
                            <input type="text" name="info[phone]" placeholder="请输入店铺电话" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="info[address]" placeholder="请输入商户地址" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户销量</label>
                        <div class="layui-input-block">
                            <input type="text" name="info[sales_volume]" placeholder="请输入商户销量" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户人均</label>
                        <div class="layui-input-block">
                            <input type="text" name="info[per_capita]" placeholder="请输入商户人均" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户评分</label>
                        <div class="layui-input-block">
                            <input type="text" name="info[score]" placeholder="请输入商户人均" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin:auto;text-align: center;">
                            <button type="button" class="upButton layui-btn layui-btn-primary"><i
                                    class="fa fa-level-up"></i> 上一步</button>
                            <button type="button" class="downButton layui-btn layui-btn-normal"><i
                                    class="fa fa-level-down"></i> 下一步</button>
                        </div>
                    </div>
                </div>

                <div class="layui-tab-item">
                    <div class="layui-form-item">
                        <label class="layui-form-label">真实姓名</label>
                        <div class="layui-input-block">
                            <input type="text" name="full[full_name]" placeholder="请输入真实姓名" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">身份证号</label>
                        <div class="layui-input-block">
                            <input type="text" name="full[full_id]" placeholder="请输入身份证号" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">身份证正面</label>
                        <div class="layui-input-block">
                            <input type="text" name="full[full_id_image]" id="full_id_image" value="" autocomplete="off"
                                class="layui-input layui-col-xs6" readonly>
                            <div class="layuimini-upload-btn">
                                <button type="button" class="layui-btn" id="upload_full_id_image"><i
                                        class="fa fa-upload"></i>
                                    上传图片</button>
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">拍摄店面</label>
                        <div class="layui-input-block">
                            <input type="text" name="full[storefront_image]" id="storefront_image" value="" autocomplete="off"
                                class="layui-input layui-col-xs6" readonly>
                            <div class="layuimini-upload-btn">
                                <button type="button" class="layui-btn" id="upload_storefront_image"><i
                                        class="fa fa-upload"></i>
                                    上传图片</button>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">工商局</label>
                        <div class="layui-input-block">
                            <input type="text" name="full[registration]" id="registration" value="" autocomplete="off"
                                class="layui-input layui-col-xs6" readonly>
                            <div class="layuimini-upload-btn">
                                <button type="button" class="layui-btn" id="upload_registration"><i
                                        class="fa fa-upload"></i>
                                    上传图片</button>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">营业执照</label>
                        <div class="layui-input-block">
                            <input type="text" name="full[permit_image]" id="permit_image" value="" autocomplete="off"
                                class="layui-input layui-col-xs6" readonly>
                            <div class="layuimini-upload-btn">
                                <button type="button" class="layui-btn" id="upload_permit_image"><i
                                        class="fa fa-upload"></i>
                                    上传图片</button>
                            </div>
                        </div>
                    </div>
                 
                    <div class="layui-form-item">
                        <label class="layui-form-label">服务许可证</label>
                        <div class="layui-input-block">
                            <input type="text" name="full[restaurant]" id="restaurant" value="" autocomplete="off"
                                class="layui-input layui-col-xs6" readonly>
                            <div class="layuimini-upload-btn">
                                <button type="button" class="layui-btn" id="upload_restaurant"><i
                                        class="fa fa-upload"></i>
                                    上传图片</button>
                            </div>
                        </div>
                    </div>
             
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin:auto;text-align: center;">
                            <button type="button" class="upButton layui-btn layui-btn-primary"><i
                                    class="fa fa-level-up"></i> 上一步</button>
                            <button type="button" class="downButton layui-btn layui-btn-normal"><i
                                    class="fa fa-level-down"></i> 下一步</button>
                        </div>
                    </div>
                </div>

                <div class="layui-tab-item">
                    <div class="layui-form-item">
                        <label class="layui-form-label">开户行</label>
                        <div class="layui-input-block">
                            <input type="text" name="bank_where" placeholder="请输入开户行" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">银行卡号</label>
                        <div class="layui-input-block">
                            <input type="text" name="bank_number" placeholder="请输入银行卡号" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">持卡人姓名</label>
                        <div class="layui-input-block">
                            <input type="text" name="bank_name" placeholder="请输入持卡人姓名" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin:auto;text-align: center;">
                            <button type="button" class="upButton layui-btn layui-btn-primary"><i
                                    class="fa fa-level-up"></i> 上一步</button>
                            <button type="button" class="downButton layui-btn layui-btn-normal"><i
                                    class="fa fa-level-down"></i> 下一步</button>
                        </div>
                    </div>
                </div>
                
                <div class="layui-tab-item">

                    <div class="layui-form-item">
                        <label class="layui-form-label">营业状态</label>
                        <div class="layui-input-block">
                            <input type="radio" name="info[is_state]" value="1" title="开启" checked>
                            <input type="radio" name="info[is_state]" value="0" title="禁用">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">推荐状态</label>
                        <div class="layui-input-block">
                            <input type="radio" name="info[recommend_status]" value="1" title="开启" checked>
                            <input type="radio" name="info[recommend_status]" value="0" title="关闭">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">优选商家</label>
                        <div class="layui-input-block">
                            <input type="radio" name="info[preferred]" value="1" title="开启" checked>
                            <input type="radio" name="info[preferred]" value="0" title="关闭">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">满减使用</label>
                        <div class="layui-input-block">
                            <input type="radio" name="info[is_decrement]" value="1" title="开启" checked>
                            <input type="radio" name="info[is_decrement]" value="0" title="关闭">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">红包使用</label>
                        <div class="layui-input-block">
                            <input type="radio" name="info[is_red]" value="1" title="开启" checked>
                            <input type="radio" name="info[is_red]" value="0" title="关闭">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">平台红包</label>
                        <div class="layui-input-block">
                            <input type="radio" name="info[is_platform_red]" value="1" title="开启" checked>
                            <input type="radio" name="info[is_platform_red]" value="0" title="关闭">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin:auto;text-align: center;">
                            <button type="button" class="upButton layui-btn layui-btn-primary"><i
                                    class="fa fa-level-up"></i> 上一步</button>
                            <button type="button" class="downButton layui-btn layui-btn-normal"><i
                                class="fa fa-level-down"></i> 下一步</button>
                        </div>
                    </div>
                </div>

                <div class="layui-tab-item">
                
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 200px;">满减补助</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="info[subsidy_is_decrement]" value="1" title="开启">
                            <input type="radio" name="info[subsidy_is_decrement]" value="0" title="关闭" checked>
                        </div>
                        <div class="layui-input-inline">
                            <input type="number" name="info[subsidy_fee_decrement]" value="" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">百分比</div>
                    </div>

                                    
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 200px;">平台红包补助</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="info[subsidy_is_platform_red]" value="1" title="开启">
                            <input type="radio" name="info[subsidy_is_platform_red]" value="0" title="关闭" checked>
                        </div>
                        <div class="layui-input-inline">
                            <input type="number" name="info[subsidy_fee_platform_red]" value="" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">百分比</div>
                    </div>

                                    
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 200px;">配送费补助</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="info[subsidy_is_delivery]" value="1" title="开启">
                            <input type="radio" name="info[subsidy_is_delivery]" value="0" title="关闭" checked>
                        </div>
                        <div class="layui-input-inline">
                            <input type="number" name="info[subsidy_fee_delivery]" value="" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">百分比</div>
                    </div>

                                    
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 200px;">红包补助</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="info[subsidy_is_red]" value="1" title="开启">
                            <input type="radio" name="info[subsidy_is_red]" value="0" title="关闭" checked>
                        </div>
                        <div class="layui-input-inline">
                            <input type="number" name="info[subsidy_fee_red]" value="" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">百分比</div>
                    </div>
                                    
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 200px;">商品补助</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="info[subsidy_is_goods]" value="1" title="开启">
                            <input type="radio" name="info[subsidy_is_goods]" value="0" title="关闭" checked>
                        </div>
                        <div class="layui-input-inline">
                            <input type="number" name="info[subsidy_fee_goods]" value="" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">百分比</div>
                    </div>
                                                        
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 200px;">总金额抽点百分比</label>
                        <div class="layui-input-inline">
                            <input type="number" name="info[draw_fee]" value="" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">百分比</div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin:auto;text-align: center;">
                            <button type="button" class="upButton layui-btn layui-btn-primary"><i
                                    class="fa fa-level-up"></i> 上一步</button>
                            <button id="saveButton" type="submit" class="layui-btn"><i class="fa fa-check"></i>
                                提交</button>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </form>
</div>
<script src="/static/admin/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/admin/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
      layui.use(['layer', 'form', 'laydate', 'element', 'upload'], function () {

        var $ = layui.$, layer = layui.layer, table = layui.table,  element = layui.element,laydate = layui.laydate, form = layui.form, upload = layui.upload;
        var indexFrame = parent.layer.getFrameIndex(window.name); //获取窗口索引

        $("#saveButton").on('click', function () {
            var loading = layer.open({ type: 3 });
            $.ajax({
                url: "{:url('add')}",
                type: 'post',
                data: $("#DataForm").serialize(),
                success: function (data) {
                    console.log(data);
                    layer.close(loading);
                    if (data.code == 0) {
                        parent.tableReload();
                        parent.layer.close(indexFrame);
                        parent.layer.msg(data.msg);
                    } else {
                        layer.msg(data.msg);
                    }
                }
            })
            return false;
        })

        $("#closeButton").on('click', function () {
            parent.layer.close(indexFrame);
        })

        // 分步表单下一步
        $(".downButton").on('click', function () {
            var id = $(".layui-this").next().attr('lay-id');
            element.tabChange('itemTab', id);
        });
        // 分步表单上一步
        $(".upButton").on('click', function () {
            var id = $(".layui-this").prev().attr('lay-id');
            element.tabChange('itemTab', id);
        });

        upload.render({
                elem: '#upload_logo', url: "{:url('common/images')}", done: function (res) {
                        $("#logo").val(res.data.url);
                        layer.msg(res.msg);
                }
        });

        upload.render({
                elem: '#upload_full_id_image', url: "{:url('common/images')}", done: function (res) {
                        $("#full_id_image").val(res.data.url);
                        layer.msg(res.msg);
                }
        });

        upload.render({
                elem: '#upload_registration', url: "{:url('common/images')}", done: function (res) {
                        $("#registration").val(res.data.url);
                        layer.msg(res.msg);
                }
        });

        upload.render({
                elem: '#upload_storefront_image', url: "{:url('common/images')}", done: function (res) {
                        $("#storefront_image").val(res.data.url);
                        layer.msg(res.msg);
                }
        });

        upload.render({
                elem: '#upload_permit_image', url: "{:url('common/images')}", done: function (res) {
                        $("#permit_image").val(res.data.url);
                        layer.msg(res.msg);
                }
        });

        upload.render({
                elem: '#upload_restaurant', url: "{:url('common/images')}", done: function (res) {
                        $("#restaurant").val(res.data.url);
                        layer.msg("成功");
                }
        });

        });
</script>
</body>
</html>